package cn.powerone.scm.service.impl;

import java.util.List;
import cn.powerone.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.powerone.scm.mapper.ScmInventoryProductLocationMapper;
import cn.powerone.scm.domain.ScmInventoryProductLocation;
import cn.powerone.scm.service.IScmInventoryProductLocationService;

/**
 * 产品与库位对应关系Service业务层处理
 *
 * @author PowerOne
 * @date 2025-08-30
 */
@Service
public class ScmInventoryProductLocationServiceImpl implements IScmInventoryProductLocationService
{
    @Autowired
    private ScmInventoryProductLocationMapper scmInventoryProductLocationMapper;

    /**
     * 查询产品与库位对应关系
     *
     * @param id 产品与库位对应关系主键
     * @return 产品与库位对应关系
     */
    @Override
    public ScmInventoryProductLocation selectScmInventoryProductLocationById(Long id)
    {
        return scmInventoryProductLocationMapper.selectScmInventoryProductLocationById(id);
    }

    /**
     * 查询产品与库位对应关系列表
     *
     * @param scmInventoryProductLocation 产品与库位对应关系
     * @return 产品与库位对应关系
     */
    @Override
    public List<ScmInventoryProductLocation> selectScmInventoryProductLocationList(ScmInventoryProductLocation scmInventoryProductLocation)
    {
        return scmInventoryProductLocationMapper.selectScmInventoryProductLocationList(scmInventoryProductLocation);
    }

    /**
     * 新增产品与库位对应关系
     *
     * @param scmInventoryProductLocation 产品与库位对应关系
     * @return 结果
     */
    @Override
    public int insertScmInventoryProductLocation(ScmInventoryProductLocation scmInventoryProductLocation)
    {
        scmInventoryProductLocation.setCreateTime(DateUtils.getNowDate());
        return scmInventoryProductLocationMapper.insertScmInventoryProductLocation(scmInventoryProductLocation);
    }

    /**
     * 修改产品与库位对应关系
     *
     * @param scmInventoryProductLocation 产品与库位对应关系
     * @return 结果
     */
    @Override
    public int updateScmInventoryProductLocation(ScmInventoryProductLocation scmInventoryProductLocation)
    {
        scmInventoryProductLocation.setUpdateTime(DateUtils.getNowDate());
        return scmInventoryProductLocationMapper.updateScmInventoryProductLocation(scmInventoryProductLocation);
    }

    /**
     * 批量删除产品与库位对应关系
     *
     * @param ids 需要删除的产品与库位对应关系主键
     * @return 结果
     */
    @Override
    public int deleteScmInventoryProductLocationByIds(Long[] ids)
    {
        return scmInventoryProductLocationMapper.deleteScmInventoryProductLocationByIds(ids);
    }

    /**
     * 删除产品与库位对应关系信息
     *
     * @param id 产品与库位对应关系主键
     * @return 结果
     */
    @Override
    public int deleteScmInventoryProductLocationById(Long id)
    {
        return scmInventoryProductLocationMapper.deleteScmInventoryProductLocationById(id);
    }
}
